package controller.link.game;

import view.client.Console;
import model.Hearer;
import java.io.Serializable;
import controller.Link;
import model.game.Player;
import model.User;
import controller.Waiting;
import model.Attendant;
import model.Server;

public class Died implements Link, Serializable {

    private Player player;

    public Died() {
    }

    public Died(Server server, Attendant at) {
        User user = at.getUser();
        player = user.getPlayer();
        at.send((Link) this);
    }

    public Died(Hearer h) {
        h.send((Link) this);
    }

    @Override
    public void serverUse(Server server, Attendant at) {
        server.getWorld().getMap().respawnPlayer(player);
        Waiting waiting = new Waiting(player, at, server, 2000, "Respawn Penalty");
        at.send((Link) this);
    }

    @Override
    public void clientUse(Console console) {
    }
}
